package com.ruoyi.pay.manager.service.impl;

import java.util.List;

import com.basic.service.impl.BaseServiceImpl;
import com.common.util.CopyEntity;
import com.param.concat.IIdParam;
import com.ruoyi.pay.manager.domain.ChangeRecord;
import com.ruoyi.pay.manager.mapper.ChangeRecordMapper;
import com.ruoyi.pay.manager.service.IChangeRecordService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

/**
 * 余额变更记录Service业务层处理
 * 
 * @author 王强
 * @date 2023-12-25
 */
@Service
public class ChangeRecordServiceImpl extends BaseServiceImpl<Long, ChangeRecord>  implements IChangeRecordService 
{
    public ChangeRecordServiceImpl(ChangeRecordMapper baseMapper) {
		super(baseMapper);
		// TODO Auto-generated constructor stub
	}


    /**
     * 查询余额变更记录
     * 
     * @param id 余额变更记录主键
     * @return 余额变更记录
     */
    @Override
    public ChangeRecord selectById(Integer id)
    {
        return baseMapper.selectById(id);
    }

    /**
     * 查询余额变更记录列表
     * 
     * @param changeRecord 余额变更记录
     * @return 余额变更记录
     */
    @Override
    public List<ChangeRecord> selectList(ChangeRecord changeRecord)
    {
        return baseMapper.selectList(changeRecord);
    }

    /**
     * 新增余额变更记录
     * 
     * @param changeRecord 余额变更记录
     * @return 结果
     */
    @Override
    public int insert(ChangeRecord changeRecord)
    {
        return baseMapper.insert(changeRecord);
    }

    /**
     * 修改余额变更记录
     * 
     * @param changeRecord 余额变更记录
     * @return 结果
     */
    @Override
    public int update(ChangeRecord changeRecord)
    {
        return baseMapper.update(changeRecord);
    }

    /**
     * 批量删除余额变更记录
     * 
     * @param ids 需要删除的余额变更记录主键
     * @return 结果
     */
    @Override
    public int deleteByIds(Integer[] ids)
    {
        return baseMapper.deleteByIds(ids);
    }

    /**
     * 删除余额变更记录信息
     * 
     * @param id 余额变更记录主键
     * @return 结果
     */
    @Override
    public int deleteById(Integer id)
    {
        return baseMapper.deleteById(id);
    }

	@Override
	@Transactional(propagation = Propagation.MANDATORY)
	public <P> int insertParam(P changeRecord) {
		
		ChangeRecord record = CopyEntity.copyEntity(changeRecord, ChangeRecord.class);
		
		insertProperties(record);
		
		return this.baseMapper.insert(record);
	}


	@Override
	public List<ChangeRecord> selectList(IIdParam idParam) {
		// TODO Auto-generated method stub
		return this.baseMapper.selectListByUserId(idParam);
	}
}
